package cn.com.jit.oa.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import cn.com.jit.oa.base.BaseDaoImpl;
import cn.com.jit.oa.dao.DepartmentDao;
import cn.com.jit.oa.dao.RoleDao;
import cn.com.jit.oa.domain.Department;
import cn.com.jit.oa.domain.Role;

@Repository
public class DepartmentDaoImpl extends BaseDaoImpl<Department> implements DepartmentDao {

	@Override
	public List<Department> findTopList() {
		return getSession().createQuery("FROM Department where parent is null").list();
	}

	@Override
	public List<Department> findChildrenList(Long parentId) {
		return getSession().createQuery("FROM Department where parent.id = ?")//
			.setParameter(0, parentId)//
			.list();
	}

	

}
